import DEVICECALI from 'service/apis/deviceCali';
import Request from 'service/request';

// 获取列表
export async function getList(params) {
  return Request({
    url: DEVICECALI.LIST + '?ver=' + (new Date()).getTime(),
    data: params,
    method: 'POST',
  });
}

// 增加列表
export async function addList(params) {
  return Request({
    url: DEVICECALI.ADD_LIST,
    data: params,
    method: 'POST',
  });
}

// 删除列表项
export async function delList({ id }) {
  return Request({
    url: DEVICECALI.DEL_LIST + id,
    method: 'DELETE',
  });
}

// 修改检定
export async function updateCali(params) {
  return Request({
    url: DEVICECALI.UPDATE_CALI + params.id,
    data: params,
    method: 'PUT',
  });
}

// 停用或者启用
export async function caliOpenOrStop({ id, status }) {
  return Request({
    url: DEVICECALI.OPEN_OR_STOP_CALI + id + '?status=' + status,
    method: 'GET',
  });
}

// 详情数据
export async function getDetail({ id }) {
  return Request({
    url: DEVICECALI.DETAIL_INFO + id + '?ver=' + (new Date()).getTime(),
  });
}

// 完成计划
export async function finishPlan(params) {
  return Request({
    url: DEVICECALI.FINISH_PLAN + params.id,
    data: params,
    method: 'PUT',
  });
}

// 节点流程
export async function getProgress({ id }) {
  return Request({
    url: DEVICECALI.PROCESS_GET + '/' + id + '?ver=' + (new Date()).getTime(),
  });
}
